package experiment5.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ScreenInput2 implements Runnable {
    @Override
    public void run() {
        while (true) {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str = null;
            try {
                str = br.readLine();
                if (str != null && !str.trim().equals("")) {
                    System.out.println("读入：" + str);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

    public static void main(String[] args) {
        ScreenInput2 si2 = new ScreenInput2();
        Thread thread1 = new Thread(si2);
        thread1.start();
        Thread thread2 = new Thread(si2);
        thread1.start();
        thread2.start();
        ScreenInput si = new ScreenInput(null);
        si.start();
    }
}
